function t(a) {
    e.showLoading("正在加载数据"), wx.request({
        url: s.globalData.host + "/lotto/v1/list",
        method: "GET",
        dataType: "json",
        data: {
            access_token: e.getToken(),
            type: a.data.type,
            page: a.data.page,
            count: 10
        },
        success: function(o) {
            if (e.hideLoading(), -500 != o.data.sta) if (0 == o.data.sta) {
                var s = o.data.data, i = a.data.page, n = !1;
                10 == s.length && (n = !0);
                for (var d = 0; d < s.length; d++) s[d].date = e.formatDate(1e3 * s[d].date, "MM/dd HH:mm");
                a.setData({
                    lottoList: 1 == i ? s : a.data.lottoList.concat(s),
                    page: i + 1,
                    moreData: n
                });
            } else e.showFailedToast("数据加载失败", o.data.msg); else e.login(function() {
                t(a);
            });
        },
        fail: function(t) {
            e.showFailedToast("数据加载失败");
        }
    });
}

function a(t) {
    e.showLoading("正在加载数据"), wx.request({
        url: s.globalData.host + "/lotto/v1/list",
        method: "GET",
        dataType: "json",
        data: {
            access_token: e.getToken(),
            type: 3,
            page: t.data.page,
            count: 10,
            lid: t.data.lid
        },
        success: function(o) {
            if (e.hideLoading(), -500 != o.data.sta) if (0 == o.data.sta) {
                var s = o.data.data;
                t.setData({
                    lottoList: s,
                    moreData: !1
                });
            } else e.showFailedToast("数据加载失败", o.data.msg); else e.login(function() {
                a(t);
            });
        },
        fail: function(t) {
            e.showFailedToast("数据加载失败");
        }
    });
}

var e = require("../../utils/util.js"), o = require("../../tmp/tmp.js"), s = getApp();

Page({
    data: {
        page: 1,
        moreData: !1,
        enrollList: null,
        type: 3,
        currentTab: 1
    },
    onLoad: function() {
        o.enRoll(this, t);
    },
    onShow: function(a) {
        t(this), this.setData({
            toDetail: !1
        });
    },
    onReachBottom: function() {
        this.data.moreData && t(this);
    },
    toCreate: function() {
        e.buttonClicked(this), wx.navigateTo({
            url: "/pages/create/create"
        });
    },
    postFormId: function(t) {
        e.postFormId(t.detail.formId);
    },
    tabChange: function(a) {
        var e = a.currentTarget.dataset.id, o = 3;
        2 == e ? o = 4 : 3 == e && (o = 5), this.setData({
            currentTab: e,
            type: o,
            page: 1,
            moreData: !0
        }), t(this);
    },
    search: function(t) {
        var o = t.detail.value;
        "" != o ? (this.setData({
            lid: o
        }), a(this)) : e.showModelTips("请输入抽奖ID");
    },
    closeSponsorDialog: function() {
        this.setData({
            sponsorDialog: !1
        });
    },
    inputSponsor: function(t) {
        var a = t.currentTarget.dataset.id;
        1 == a ? this.setData({
            sponsor: t.detail.value
        }) : 2 == a ? this.setData({
            appid: t.detail.value
        }) : 3 == a && this.setData({
            path: t.detail.value
        });
    }
});